<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\cms\model\project_meeting_invitation;

use app\cms\model\charge\ProjectMeetingServiceCharge;
use app\cms\model\cuc\ProjectMeetingCuc;
use app\cms\model\emailRecord\ProjectMeetingInvitationEmailRecord;
use app\cms\model\meetingAfterLetter\ProjectMeetingAfterTheMeeting;
use app\cms\model\meetingChinaVisaScan\ProjectMeetingChinaVisaScan;
use app\cms\model\meetingFinalStatement\ProjectMeetingFinalStatement;
use app\cms\model\meetingFinalTravel\ProjectMeetingFinalTravel;
use app\cms\model\meetingFrequentFlyer\ProjectMeetingFrequentFlyer;
use app\cms\model\meetingInvitationLetter\ProjectMeetingInvitationLetter;
use app\cms\model\meetingInvitationLetterNumber\ProjectMeetingInvitationLetterNumber;
use app\cms\model\meetingLetterReimburjsementScan\ProjectMeetingLetterReimbursementScan;
use app\cms\model\meetingOnline\ProjectMeetingOnlineConference;
use app\cms\model\meetingPickUpAndTips\ProjectMeetingPickupAndTips;
use app\cms\model\meetingPptFollowUp\ProjectMeetingPptFollowUp;
use app\cms\model\meetingPptReturnDeadline\ProjectMeetingPptReturnDeadline;
use app\cms\model\meetingPptTranslate\ProjectMeetingPptTranslate;
use app\cms\model\meetingQuestions\ProjectMeetingQuestionnaire;
use app\cms\model\meetingReimbursement\ProjectMeetingReimbursement;
use app\cms\model\meetingSchedule\ProjectMeetingSchedule;
use app\cms\model\meetingSignAgreement\ProjectMeetingSignAgreement;
use app\cms\model\meetingSpeakerPassport\ProjectMeetingSpeakerPassport;
use app\cms\model\meetingSpeakerResume\ProjectMeetingSpeakerResume;
use app\cms\model\meetingTranslateToLecturer\ProjectMeetingPptTranslateProblem;
use app\cms\model\meetingVisaPackage\ProjectMeetingVisaPackage;
use app\cms\model\meetingVisaProgram\ProjectMeetingVisaProgram;
use app\cms\model\Project;
use app\cms\model\ProjectMeeting;
use app\cms\model\Speaker;
use app\cms\model\SpeakerPassport;
use app\cms\model\SpeakerResume;
use app\cms\model\uploadData\ProjectMeetingUploadData;
use plugin\saiadmin\app\model\system\SystemUser;
use plugin\saiadmin\basic\BaseModel;

/**
 * 邀请阶段模型
 */
class ProjectMeetingInvitationSpeaker extends BaseModel
{

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 数据库表名称
     * @var string
     */
    protected $table = 'eb_project_meeting_invitation_speaker';


    /**
     * 讲者姓名 搜索
     */
    public function searchSpeakerNameAttr($query, $value)
    {
        $query->where('speaker_name', 'like', '%' . $value . '%');
    }

    /**
     * 关联邮件记录
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-12-11
     * @return void
     */
    public function emailRecord()
    {
        return $this->hasMany(ProjectMeetingInvitationEmailRecord::class, 'project_meeting_invitation_speaker_id', 'id');
    }

    /**
     * 关联后台管理员
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-12-11
     * @return void
     */
    public function adminUser()
    {
        return $this->hasOne(SystemUser::class, 'id', 'created_by');
    }

    /**
     * 关联外讲库讲者表
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function speaker()
    {
        return $this->hasOne(Speaker::class, 'id', 'speaker_id');
    }

    /**
     * 关联资料上传
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-21
     * @return void
     */
    public function uploadData()
    {
        return $this->hasOne(ProjectMeetingUploadData::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 关联 cuc
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-21
     * @return void
     */
    public function cuc()
    {
        return $this->hasOne(ProjectMeetingCuc::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 关联 劳务支付
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-21
     * @return void
     */
    public function charge()
    {
        return $this->hasOne(ProjectMeetingServiceCharge::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 索要讲者简历+头像
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function speakerResume()
    {
        return $this->hasOne(ProjectMeetingSpeakerResume::class, 'invitation_speaker_id', 'id');
    }
    /**
     * 常规邮件&发送状态
     * 索要讲者付款信息+护照
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function speakerPassport()
    {
        return $this->hasOne(ProjectMeetingSpeakerPassport::class, 'invitation_speaker_id', 'id');
    }


    /**
     * 关联讲者简历表
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-09-12
     * @return void
     */
    public function resume()
    {
        return $this->hasOne(SpeakerResume::class, 'id', 'speaker_id');
    }
    /**
     * 关联讲者护照表
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-09-12
     * @return void
     */
    public function passport()
    {
        return $this->hasOne(SpeakerPassport::class, 'id', 'speaker_id');
    }
    /**
     * 常规邮件&发送状态
     * 签订协议
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function signAgreement()
    {
        return $this->hasOne(ProjectMeetingSignAgreement::class, 'invitation_speaker_id', 'id');
    }
    /**
     * 常规邮件&发送状态
     * PPT要求及其返回时间
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function pptReturnDeadline()
    {
        return $this->hasOne(ProjectMeetingPptReturnDeadline::class, 'invitation_speaker_id', 'id');
    }
    /**
     * 常规邮件&发送状态
     * PPT跟进
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function pptFollowUp()
    {
        return $this->hasOne(ProjectMeetingPptFollowUp::class, 'invitation_speaker_id', 'id');
    }
    /**
     * 常规邮件&发送状态
     * 翻译PPT给讲者
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function pptTranslate()
    {
        return $this->hasOne(ProjectMeetingPptTranslate::class, 'invitation_speaker_id', 'id');
    }
    /**
     * 常规邮件&发送状态
     * 翻译讨论问题给讲者
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function translateToLecturer()
    {
        return $this->hasOne(ProjectMeetingPptTranslateProblem::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线上-线上会议&测试
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function meetingOnline()
    {
        return $this->hasOne(ProjectMeetingOnlineConference::class, 'invitation_speaker_id', 'id');
    }
    /**
     * 常规邮件&发送状态
     * 线上-可编辑日程
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function meetingSchedule()
    {
        return $this->hasOne(ProjectMeetingSchedule::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线上-会后感谢信
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-22
     * @return void
     */
    public function meetingAfter()
    {
        return $this->hasOne(ProjectMeetingAfterTheMeeting::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-签证计划
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function visaProgram()
    {
        return $this->hasOne(ProjectMeetingVisaProgram::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-签证包
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function visaPackage()
    {
        return $this->hasOne(ProjectMeetingVisaPackage::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-邀请函
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function invitationLetter()
    {
        return $this->hasOne(ProjectMeetingInvitationLetter::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-邀请函邮寄单号
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function invitationLetterNumber()
    {
        return $this->hasOne(ProjectMeetingInvitationLetterNumber::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-常旅客号
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function frequentFlyer()
    {
        return $this->hasOne(ProjectMeetingFrequentFlyer::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-发送喜好问卷
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function meetingQuestions()
    {
        return $this->hasOne(ProjectMeetingQuestionnaire::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-最终行程
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function finalTravel()
    {
        return $this->hasOne(ProjectMeetingFinalTravel::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-中国签证扫描页
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function chinaVsiaScan()
    {
        return $this->hasOne(ProjectMeetingChinaVisaScan::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-接机安排和温馨提示
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function pickUpAndTips()
    {
        return $this->hasOne(ProjectMeetingPickupAndTips::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-活动感谢信+询问报销+出入境扫描件
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function scan()
    {
        return $this->hasOne(ProjectMeetingLetterReimbursementScan::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-报销单据
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function reimbursement()
    {
        return $this->hasOne(ProjectMeetingReimbursement::class, 'invitation_speaker_id', 'id');
    }

    /**
     * 常规邮件&发送状态
     * 线下-结算单
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-26
     * @return void
     */
    public function statement()
    {
        return $this->hasOne(ProjectMeetingFinalStatement::class, 'invitation_speaker_id', 'id');
    }

    public function project()
    {
        return $this->belongsTo(Project::class, 'project_id', 'id');
    }

    public function projectMeeting()
    {
        return $this->belongsTo(ProjectMeeting::class, 'project_meeting_id', 'id');
    }
}
